package com.my.chapter8;

public class practice12 {
    public static void main(String[] args) {
        Rodent1 r = new Rodent1();
        System.out.println("");
        Mouse1 m =new Mouse1();
        System.out.println("");
        Gerbil1 g = new Gerbil1();
        System.out.println("");
        Hamster1 h =new Hamster1();
    }
}

class Rodent1{
    Rodent1(){
        System.out.println("Rodent()");
    }
    public void eat(){
        System.out.println("啮齿动物吃东西");
    }
}

class Mouse1 extends Rodent1{
    private Rodent1 r = new Rodent1();
    Mouse1(){
        System.out.println("Mouse()");
    }
    public void eat(){
        System.out.println("老鼠吃东西");
    }
}

class Gerbil1 extends Rodent1{
    Gerbil1(){
        System.out.println("Gerbil()");
    }
    public void eat(){
        System.out.println("鼹鼠吃东西");
    }
}

class Hamster1 extends Rodent1{
    private Mouse1 m =new Mouse1();
    private Gerbil1 g = new Gerbil1();
    Hamster1(){
        System.out.println("Hamster()");
    }
    public void eat(){
        System.out.println("大颊鼠吃东西");
    }
}
